package com.demo.config;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;


/**
 * @Author： yu.Tan
 * @Date: 2020/8/27 10:32
 * @Description: 结果信息
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Response<T> {
    private static final long serialVersionUID = 1L;

    private int code;
    private String msg;
    private T data;

    public static <T> Response<T> ok(T data) {
        int okCode = 200;
        return new Response<>(okCode, "请求成功", data);
    }

    public static <T> Response<T> error(String msg) {
        return new Response<>(500, msg,null);
    }

}
